--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.
--Audit Triggers For Version 1.0.0.0
--Generated on 2010-07-21 20:57:25

--DROP ANY AUDIT TRIGGERS FOR [dbo].[Customer]
if exists(select * from sysobjects where name = '__TR_Customer__INSERT' AND xtype = 'TR')
DROP TRIGGER [dbo].[__TR_Customer__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_Customer__UPDATE' AND xtype = 'TR')
DROP TRIGGER [dbo].[__TR_Customer__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_Customer__DELETE' AND xtype = 'TR')
DROP TRIGGER [dbo].[__TR_Customer__DELETE]
GO

--CREATE TRIGGER INSERT FOR [dbo].[Customer]
CREATE TRIGGER [dbo].[__TR_Customer__INSERT]
ON [dbo].[Customer]
FOR INSERT AS
INSERT INTO [dbo].[__AUDIT__Customer] ([__action],[CustomerId],[Name],[ModifiedBy],[__insertdate])
SELECT 1, [CustomerId],[Name],[ModifiedBy],getutcdate() FROM [inserted]
GO

--CREATE TRIGGER UPDATE FOR [dbo].[Customer]
CREATE TRIGGER [dbo].[__TR_Customer__UPDATE]
ON [dbo].[Customer]
FOR UPDATE AS
INSERT INTO [dbo].[__AUDIT__Customer] ([__action],[CustomerId],[Name],[ModifiedBy],[__insertdate])
SELECT 2, [CustomerId],[Name],[ModifiedBy],getutcdate() FROM [inserted]
GO

--CREATE TRIGGER DELETE FOR [dbo].[Customer]
CREATE TRIGGER [dbo].[__TR_Customer__DELETE]
ON [dbo].[Customer]
FOR DELETE AS
INSERT INTO [dbo].[__AUDIT__Customer] ([__action],[CustomerId],[Name],[ModifiedBy],[__insertdate])
SELECT 3, [CustomerId],[Name],[ModifiedBy],getutcdate() FROM [deleted]
GO

